import {MutationTree} from 'vuex';
import {InterfaceUser} from '@/interface/InterfaceUser';
import * as types from '@/store/mutation-types';

export default class DataCacheStore {
    public static initState: any = {
        cartObjectData: {},
        cartListData: [],
        friendData: [],
        categoryList: [],
        mallProductList: [],
        mallBannerList: [],
        chatLog: {},
        expertList: [],
        gameTip: true,
    };
    public static state: any = DataCacheStore.initState;

    public static mutations: MutationTree<any> = {
        [types.DATA_CACHE_UPDATE](state: any, data: any) {
            state = Object.assign(state, data);
        },
        [types.DATA_CACHE_REMOVE](state: any, key) {
            state = Object.assign(state[key], {});
        },
        [types.DATA_CACHE_CLEAR](state: any) {
            state = Object.assign(state, DataCacheStore.initState);
        },
    };
}
